package com.coustemview.qianfeng.huaqiangbeistore.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.coustemview.qianfeng.huaqiangbeistore.R;
import com.coustemview.qianfeng.huaqiangbeistore.model.Oversear_specialevaluate_handler;

import java.util.List;

/**
 * Created by mingma on 2016/9/1.
 */
public class Oversear_listview_evaluate_adapter extends BaseAdapter {
    private List<Oversear_specialevaluate_handler>list;
    private Context context;

    public Oversear_listview_evaluate_adapter(List<Oversear_specialevaluate_handler> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder=null;
          if(convertView==null) {
             convertView= LayoutInflater.from(context).inflate(R.layout.oversear_listview_evaluate_item,null);
              holder=new ViewHolder(convertView);
              convertView.setTag(holder);
          }else{
             holder= (ViewHolder) convertView.getTag();
          }
        Oversear_specialevaluate_handler handler = list.get(position);
          holder.textViewnickname.setText(handler.nickName);
          holder.textViewcontent.setText(handler.content);
          holder.textViewtime.setText(handler.createdStr);
        return convertView;
    }
    static class ViewHolder{
      TextView textViewnickname,textViewcontent,textViewtime;

        public ViewHolder(View view) {
            textViewnickname= (TextView) view.findViewById(R.id.text_listviewitem_nickname);
            textViewcontent= (TextView) view.findViewById(R.id.text_listviewitem_content);
            textViewtime= (TextView) view.findViewById(R.id.text_listviewitem_time);
        }
    }
}
